using System;
using System.Windows;
using System.Windows.Input;
using Navigator.ViewModel.Services;

namespace Navigator.ViewModel.Commands
{
    public class ShowProductCommand:ICommand
    {
        private readonly NavigatorViewModel m_ViewModel;
        private const string m_WsProductName = "ProductView";

        public ShowProductCommand(NavigatorViewModel m_ViewModel)
        {
            this.m_ViewModel = m_ViewModel;
        }

        public event EventHandler CanExecuteChanged
        {
            add{ CommandManager.RequerySuggested += value; }
            remove { CommandManager.RequerySuggested -= value;}
        }
        public void Execute(object parameter)
        {
            CommandServices.ShowWorkspace(m_WsProductName, m_ViewModel);
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }
    }
}